package com.otaku.controller;

import com.otaku.model.param.WiselyRequest;
import com.otaku.model.param.WiselyResponse;
import lombok.extern.java.Log;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

/**
 * 标题：WiselyController<br>
 * 功能说明：<br>
 * 系统版本：v1.0<br>
 * 开发人员： ganxiang20970 <br>
 * 开发时间：2018年04月17日 17:58<br>
 */
@Log
@Controller
public class WiselyController {

    @MessageMapping("/welcome")
    @SendTo("/topic/getResponse")
    public WiselyResponse sendMessage(WiselyRequest request) {
        log.info("request:" + request.toString());
        try {
            Thread.sleep(3000);
        } catch (Exception e) {
            log.warning("发送消息失败 : " + e.getMessage());
        }
        return new WiselyResponse("Welcome, " + request.getName() + "!");
    }
}
